package com.douqu.game.core.config.activity;

import com.douqu.game.core.config.common.GoodsData;
import com.douqu.game.core.entity.GameObject;
import com.douqu.game.core.util.LoadUtils;
import com.douqu.game.core.util.LogUtils;


/**
 * Created by dengbo on 2018/9/20 0020.
 */
public class SevenActivitiesConfig extends GameObject {

    public int  groupId;

     //目标类型
    public int eventType;

    public int[] conditionParam;

    public GoodsData[] rewardItem;

    public int rewardCurrency;

    public int rewardMod;

    @Override
    public boolean check()
    {
        if(conditionParam== null)
        {
            LogUtils.error("SevenActivitiesConfig check time is error -> id:" + id + " name:" + name);
            return false;
        }
        if(rewardItem == null){
            LogUtils.error("SevenActivitiesConfig check reward is null -> id:" + id + " name:" + name);
            return false;
        }
        return true;
    }

    @Override
    public boolean setVariable(String key, String value) {
        if ("rewardItem".equals(key)){
            rewardItem = LoadUtils.loadGoodDataToArray(key, value);
            return true;
        }else if ("conditionParam".equals(key)){
            conditionParam = LoadUtils.loadIntArray(key, value);
            return true;
        }
        else{
            return super.setVariable(key, value);
        }
    }

    @Override
    public String toString() {
        return "SevenDayConfig{" +
                "} " + super.toString();
    }

//    //活动类型
//    public int  type;
//    public int  tab;
//    //开放时间
//    public int[] openTime;
//    //持续时间
//    public int continuedTime;
//    //开放等级
//    public int openLevel;
//    //目标类型
//    public int eventType;
//
//    //完成奖励
//    public GoodsData[] rewardItem;
//
//    public int[] conditionParam;
//    //完成积分
//    public int rewardCurrency;
//
//    //发放奖励形式
//    public int rewardMod;
//
//
//

}
